﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Bluebunnie.Schemas;

namespace Bluebunnie
{
    /// <summary>
    /// Interaction logic for EditData.xaml
    /// </summary>
    public partial class DaftarItemEdit : UserControl
    {
        public DaftarItemEdit()
        {
            InitializeComponent();
        }

        public DaftarItemEdit(object param)
        {
            InitializeComponent();
        }

        public void Insert()
        {
            DataManager.Execute(
                @"INSERT INTO tbl_item SET ID=@ID, Barcode=@Barcode, Name=@Name, Type=@Type, Unit=@Unit, Base_Price=@Base_Price,
                 Selling_Price=@SellingPrice, Expire_Date=@ExpireDate, Stock=@Stock, Status=@Status, Note=@Note",
                 new Parameter("@ID", txtKode.Text),
                 new Parameter("@Barcode", txtKodeBarcode.Text),
                 new Parameter("@Name", txtNamaItem.Text),
                 new Parameter("@Type", cbJenis.SelectedItem),
                 new Parameter("@Unit", cbSatuan.SelectedItem),
                 new Parameter("@Base_Price", txtHargaAwal.Text),
                 new Parameter("@SellingPrice", txtHargaJual1.Text),
                 new Parameter("@ExpireDate", dpDatePicker.SelectedDate),
                 new Parameter("@Stock", txtJumlahStokAwal.Text),
                 new Parameter("@Status", rbStatusProduk1.IsChecked),
                 new Parameter("@Note", txtKeterangan.Text));

            Shell.Current.Close("Tambah Item");
        }
    }
}
